#ifndef FORMULAFACTORY_H_INCLUDED
#define FORMULAFACTORY_H_INCLUDED

//#define NDEBUG
#include <assert.h>
#include "formula.h"
#include "formulaelement.h"
#include "formulafactoryutil.h"

class FormulaFactory {
    private:
        static inline void createComplexFormula(LinkedList<FormulaElement>& myFormula, unsigned int& size);
        // generates a formula with complex numbers
        static inline void createRealFormula(LinkedList<FormulaElement>& myFormula, unsigned int& size);
        // generates a formula with real numbers
    public:
        static Formula* createNewFormula(unsigned int& size, bool isComplex);
        // generates a new formula
        static Formula* simpleRecombination(Formula& formula1, Formula& formula2);
        // does a very simple recombination by creating a new Formula = (formula1 + formula2) / 2
        static inline void copyFirstFormulaToTheEndOfTheSecond(Formula& fs, Formula& fd) {
            fs.getListOfFormulaElements().resetIteratorPosition();
            while (fs.getListOfFormulaElements().iteratorHasNext()) {
                fd.getListOfFormulaElements().addAtEnd(fs.getListOfFormulaElements().iteratorGetNext().copy());
            }
        };
};

#endif // FORMULAFACTORY_H_INCLUDED
